/*
 * PtrClassicAutoHeader.java
 * business
 *
 * Created by ChenTao on 2017/5/23.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.view;

import android.content.Context;

import in.srain.cube.views.ptr.PtrClassicDefaultHeader;
import in.srain.cube.views.ptr.PtrFrameLayout;
import in.srain.cube.views.ptr.indicator.PtrIndicator;

/**
 * 具备下拉位置回掉的  PtrClassicDefaultHeader
 * <p>
 * Created by ChenTao(chentao7v@gmail.com) on 2017/5/23 0023 17:42
 */
public class PtrClassicAutoHeader extends PtrClassicDefaultHeader {

    private OnUIPositionChangeListener mListener;

    public PtrClassicAutoHeader(Context context) {
        super(context);
    }

    @Override
    public void onUIPositionChange(PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator) {
        super.onUIPositionChange(frame, isUnderTouch, status, ptrIndicator);

        if (mListener != null) mListener.onUIPositionChanged(ptrIndicator.getCurrentPosY());
    }

    public void setOnUIPositionChangeListener(OnUIPositionChangeListener listener) {
        mListener = listener;
    }

    public interface OnUIPositionChangeListener {

        void onUIPositionChanged(int positionY);

    }
}
